import Vue from 'vue'
import axios from 'axios'

import App from './App'
import router from './router'
import store from './vuex/store'
import Vuex from 'vuex'

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css';
import VueI18n from 'vue-i18n'
import messages from '@/lang/index'

import filters from './filters/index.js'

//css
import '../../static/css/reset.css'

//less
import "./less/index.less"

Vue.use(ElementUI)
Vue.use(VueI18n)
Vue.use(Vuex);

if (!process.env.IS_WEB) Vue.use(require('vue-electron'))
Vue.http = Vue.prototype.$http = axios
Vue.config.productionTip = false

const browserLang = (navigator.language || navigator.browserLanguage).toLowerCase();
const browserLanguage = browserLang.indexOf('en')=='-1'?'zh-cn':'en';
const localLang = window.localStorage.getItem('user_lang')?window.localStorage.getItem('user_lang'):browserLanguage

const i18n = new VueI18n({
    //定义默认语言
    locale: localLang,
    messages
})

/* eslint-disable no-new */
window.vueVm = new Vue({
  	components: { App },
  	router,
  	i18n,
  	store,
  	Vuex:store.commit('CHANGE_LANG',localLang),
  	template: '<App/>'
}).$mount('#app')
